package com.asen.commons.core.meta.dao;

import com.asen.commons.core.meta.enums.FilterSymbolEnum;

import java.io.Serializable;
import java.util.Objects;

/**
 * 过滤条件项
 *
 * @author ls
 * @version 1.0
 * @date 2024-04-09
 */
public class FilterItem implements Serializable {

    private static final long serialVersionUID = -7138918632598609070L;

    private String fieldName;
    private FilterSymbolEnum symbol;
    private Object value;
    private String fieldName2;

    public FilterItem() {

    }

    public FilterItem(String fieldName, FilterSymbolEnum symbol, Object value) {
        this.fieldName = fieldName;
        this.symbol = symbol;
        this.value = value;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldName2() {
        return fieldName2;
    }

    public void setFieldName2(String fieldName2) {
        this.fieldName2 = fieldName2;
    }

    public FilterSymbolEnum getSymbol() {
        return symbol;
    }

    public void setSymbol(FilterSymbolEnum symbol) {
        this.symbol = symbol;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FilterItem that = (FilterItem) o;
        return Objects.equals(fieldName, that.fieldName) &&
                symbol == that.symbol &&
                Objects.equals(value, that.value) &&
                Objects.equals(fieldName2, that.fieldName2);
    }

    @Override
    public int hashCode() {

        return Objects.hash(fieldName, symbol, value, fieldName2);
    }

    @Override
    public String toString() {
        return "FilterItem{" +
                "fieldName='" + fieldName + '\'' +
                ", symbol=" + symbol +
                ", value=" + value +
                ", fieldName2='" + fieldName2 + '\'' +
                '}';
    }
}
